Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

fix: use proper flags#868

Merged
mdelapenya merged 1 commit intoelastic:masterfrom
mdelapenya:fix-enrollment-flags
Mar 10, 2021
Merged

fix: use proper flags#868
mdelapenya merged 1 commit intoelastic:masterfrom
mdelapenya:fix-enrollment-flags

Conversation

@mdelapenya
Copy link
Copy Markdown
Contributor

@mdelapenya mdelapenya commented Mar 10, 2021

What does this PR do?

It changes two things in how the enrollment flags are created:

  1. uses --enrollment-token=TOKEN instead of --enrollment-token TOKEN for TAR installer when using the install command.
  2. uses --kibana-url=KIBANA_URL flag name instead of --url=KIBANA_URL for RPM, DEB and TAR installers when using the enroll command.

Why is it important?

We started to see consistent failures for the uninstall scenario. For some reason, and this is something @michalpristas @blakerouse @EricDavisX should confirm, I was able to reproduce the following unexpected behavior:

  1. install the agent with old flags (i.e. ./elastic-agent install -f --kibana-url=http://kibana:5601 --enrollment-token TOKEN --insecure)
  2. the agent appears as enrolled in the UI, but there were no logs for the agent
  3. uninstall the agent using the uninstall -f command
  4. the agent gets to the enrolling status, but it never disappeared from the UI

After the changes in this PR, using the proper flags, the expected behaviour is satisfied.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have run the Unit tests for the CLI, and they are passing locally
  • I have run the End-2-End tests for the suite I'm working on, and they are passing locally
  • I have noticed new Go dependencies (run make notice in the proper directory)

Author's Checklist

How to test this PR locally

SUITE="fleet" TAGS="fleet_mode_agent && uninstall-host" TIMEOUT_FACTOR=3 LOG_LEVEL=TRACE DEVELOPER_MODE=true make -C e2e functional-test

Related issues

Follow-ups

Backport to 7.x, 7.12.x and 6.8.x

@mdelapenya mdelapenya self-assigned this Mar 10, 2021
@mdelapenya mdelapenya requested review from a team, EricDavisX and michalpristas March 10, 2021 10:12
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Pull request #868 opened

  • Start Time: 2021-03-10T10:12:29.562+0000

  • Duration: 29 min 45 sec

  • Commit: 97d2250

Test stats 🧪

Test Results
Failed 0
Passed 129
Skipped 0
Total 129

Trends 🧪

Image of Build Times

Image of Tests

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 129
Skipped 0
Total 129

@mdelapenya mdelapenya marked this pull request as ready for review March 10, 2021 10:43

func buildEnrollmentFlags(token string) []string {
return []string{"--url=http://kibana:5601", "--enrollment-token=" + token, "-f", "--insecure"}
return []string{"--kibana-url=http://kibana:5601", "--enrollment-token=" + token, "-f", "--insecure"}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michalpristas this is affecting the enroll command. Is this correct?

@mdelapenya
Copy link
Copy Markdown
Contributor Author

I'm going to merge this one. @michalpristas @blakerouse @EricDavisX please let me know if you have any concern about this PR, to revert or rework. Thanks!

@mdelapenya mdelapenya merged commit 9997999 into elastic:master Mar 10, 2021
@mdelapenya mdelapenya deleted the fix-enrollment-flags branch March 10, 2021 11:38
mdelapenya added a commit to mdelapenya/e2e-testing that referenced this pull request Mar 10, 2021
mdelapenya added a commit to mdelapenya/e2e-testing that referenced this pull request Mar 10, 2021
mdelapenya added a commit to mdelapenya/e2e-testing that referenced this pull request Mar 10, 2021
mdelapenya added a commit that referenced this pull request Mar 10, 2021
mdelapenya added a commit that referenced this pull request Mar 10, 2021
mdelapenya added a commit that referenced this pull request Mar 11, 2021
v1v added a commit to v1v/e2e-testing that referenced this pull request Mar 15, 2021
…hings

* upstream/master:
  [CI] tear down the workspace (elastic#885)
  docs: add Make as build system (elastic#886)
  fix: proper usage of step (elastic#883)
  feat: run most frequent flavours in the PR stage (elastic#873)
  break: move from "pull-requests" to "commits" GCP bucket (elastic#866)
  fix: use proper flags (elastic#868)
  feat: instrument Helm charts test suite (elastic#858)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fleet] Consistent errors when uninstalling the agent

4 participants